import React from 'react';
import { Form, Input, Radio } from 'antd';
import { connect } from 'umi';
import { BaseWrapper } from '@/pages/Organization/OrgFlow/components';
import Difference from '@/pages/WorkFlow/components/FormControls/components/Difference';

import { GroupLabel } from '@/pages/Setting/Privilege/components/TreeSelectGroupRoleForPrivilege';

const PostBasicInfo = ({ wrapperLayout, data, authData }) => {
    const tips = data?.tips;
    const { TextArea } = Input;
    console.log(tips, 'tips');
    return (
        <>
            <BaseWrapper title="基本信息">
                <Form {...wrapperLayout}>
                    <Form.Item label="所属机构">
                        <Difference tip={tips?.organizationName}>
                            <Input value={data?.organizationName} disabled placeholder="请选择所属部门" allowClear />
                        </Difference>
                    </Form.Item>
                    <Form.Item label="岗位名称(中文)" required>
                        <Difference tip={tips?.dutyAlias}>
                            <TextArea
                                value={data?.dutyAlias}
                                disabled
                                placeholder="请输入岗位名称"
                                autosize={{ minRows: 1, maxRows: 2 }}
                            />
                        </Difference>
                    </Form.Item>
                    <Form.Item label="岗位名称(英文)">
                        <Difference tip={tips?.dutyAliasEnglish}>
                            <TextArea
                                value={data?.dutyAliasEnglish}
                                disabled
                                placeholder="请输入岗位名称(英文)"
                                autosize={{ minRows: 1, maxRows: 2 }}
                            />
                        </Difference>
                    </Form.Item>
                    <Form.Item label="是否主管" required>
                        <Difference tip={tips?.leaderPositionFlag}>
                            <Radio.Group disabled value={data?.leaderPositionFlag}>
                                <Radio value={1}>是</Radio>
                                <Radio value={0}>否</Radio>
                            </Radio.Group>
                        </Difference>
                    </Form.Item>
                    <Form.Item label="岗位职责(中文)">
                        <Difference tip={tips?.dutyDesc}>
                            <TextArea
                                value={data?.dutyDesc}
                                disabled
                                placeholder="请输入岗位职责(中文)"
                                autosize={{ minRows: 3, maxRows: 6 }}
                            />
                        </Difference>
                    </Form.Item>
                    <Form.Item label="岗位职责(英文)">
                        <Difference tip={tips?.dutyDescEnglish}>
                            <TextArea
                                value={data?.dutyDescEnglish}
                                disabled
                                placeholder="请输入岗位职责(英文)"
                                autosize={{ minRows: 3, maxRows: 6 }}
                            />
                        </Difference>
                    </Form.Item>
                    <Form.Item label="权限模板" required>
                        <GroupLabel
                            data={authData}
                            title="权限模板"
                            value={data?.roleCodeList}
                            oldValue={tips?.roleCodeList}
                            placeholder="请选择"
                            style={{ display: 'inline-block' }}
                        />
                    </Form.Item>
                </Form>
            </BaseWrapper>
        </>
    );
};

export default connect(({ dictionary }) => ({
    dictionary
}))(PostBasicInfo);
